<!Doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>购物车</title>
    <link rel="shortcut icon" href="/img/favicon.ico">
    <link rel="stylesheet" href="/css/resetpw/base.css" />
    <link rel="stylesheet" href="/css/resetpw/layout.css"/>
    <link rel="stylesheet" href="/css/layui.css">
    <link rel="stylesheet" href="/css/zoomify.min.css">
    <link rel="stylesheet" href="/css/font-awesome.css">
    <link rel="stylesheet" href="/css/plugins/summernote/summernote.css">
    <link rel="stylesheet" href="/css/plugins/summernote/summernote-0.8.8.css">
    <link rel="stylesheet" href="/css/awesome-bootstrap-checkbox.css">
    <link rel="stylesheet" href="/css/build.css">
    <link rel="stylesheet" href="/css/front/chuanjian.css">
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/js/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="/layui/layui.js"></script>
    <script type="text/javascript" src="/js/zoomify.min.js"></script>
    <script type="text/javascript" src="/js/plugins/scroll-to/jquery.scrollTo.js"></script>
    <link rel="stylesheet" href="/js/appjs/shop/css/reset.css">
    <link rel="stylesheet" href="/js/appjs/shop/css/carts.css">
</head>
<body>

    <div th:hidden="${hidden}" th:include="include::frontheader">
    </div>
    <section class="cartMain" th:if="${ifLogin}">
        <div class="cartMain_hd">
            <ul class="order_lists cartTop">
                <li class="list_con">商品名称</li>
                <li class="list_info">商品参数</li>
                <li class="list_price">单价</li>
                <li class="list_amount">数量</li>
                <li class="list_sum">金额</li>
            </ul>
        </div>
        <div class="order_content" th:if="${#lists.isEmpty(productShopDetailList)}">
                购物车为空
        </div>
        <div class="cartBox" th:each="productShopDetai,iterStat:${productShopDetailList}">
            <div class="shop_info">
                <div class="shop_name">
                    店铺：<a href="javascript:;" th:text="*{productShopDetai.company}">搜猎人艺术生活</a>
                </div>
            </div>
            <div class="order_content">
                <ul class="order_lists" th:each="productShopEntity,iterStat:*{productShopDetai.productShopVoList}">
                    <li class="list_con">
                        <!--<div class="list_img"><a href="javascript:;"><img src="images/1.png" alt=""></a></div>-->
                        <div class="list_text"><a href="javascript:;" th:text="*{productShopEntity.productName}">夏季男士迷彩无袖T恤圆领潮流韩版修身男装背心青年时尚打底衫男</a></div>
                    </li>
                    <li class="list_info" th:text="*{productShopEntity.productType+productShopEntity.productModel}">
                        <p>规格：默认</p>
                        <p>尺寸：16*16*3(cm)</p>
                    </li>
                    <li class="list_price">
                        <p class="price" th:text="'￥'+*{productShopEntity.unitPrice}">￥980</p>
                    </li>
                    <li class="list_amount">
                        <div class="amount_box" th:text="*{productShopEntity.number}">
                        </div>
                    </li>
                    <li class="list_sum">
                        <p class="sum_price" th:text="'￥'+*{productShopEntity.unitPrice*productShopEntity.number}">￥980</p>
                    </li>
                </ul>
            </div>
        </div>


        <!--底部-->
        <div class="bar-wrapper">
            <div class="bar-right">
                <input type="hidden" name="userProductIds" th:value="${userProductIds}"/>
                <div class="piece">已选商品<strong class="piece_num" th:text="${totalNumber}">0</strong>件</div>
                <div class="totalMoney">共计: <strong class="total_text" th:text="${totalPrice}">0.00</strong></div>
                <div class="calBtn"><a href="javascript:submitOrder();" class="btn_sty">提交订单</a></div>
            </div>
        </div>
    </section>
    <script>
        function submitOrder(){
            $.ajax({
                url: "/front/submit/order",
                type: "POST",
                dataType: "json",
                data: {userProductIds: $("input[name='userProductIds']").val()},
                success: function (data) {
                    if (data.code == 0) {
                        layer.msg(data.msg)
                    }else{
                        layer.msg(data.msg)
                    }
                },
                async:true
            });
        }
    </script>
</body>
</html>